﻿@using MvcFront.DB
@using MvcFront.Enums
@using Telerik.Web.Mvc.UI
@model MvcFront.DB.Document

@{
    ViewBag.Title = "Details";
}

<h2>Детальная информация</h2>
<fieldset>
@Html.DisplayForModel()
</fieldset>
<p>
    <a href="#" onclick="ShowCommentWindow()">Оставить комментарий</a> |        
     @Html.ActionLink("Отмена", "GroupDocumentsList")
     <br />
     @{
      if(Model.DocStatus == DocumentStatus.Sended)
      {
         @Html.ActionLink("Утвердить", "Submit", new { id = Model.documentid } ) 
         <text> | </text>       
         @Html.ActionLink("Вернуть для исправлений", "Dismiss", new { id = Model.documentid })        
      }      
    }
</p>

@{ 
    Html.Telerik().Window()
        .Name("CommentWindow")
        .Title("Изменить комментарий")
        .Draggable(true)
        .Resizable(resizing => resizing
            .Enabled(true)
            .MinHeight(250)
            .MinWidth(250)
            .MaxHeight(500)
            .MaxWidth(500))
        .Modal(true)
        .Visible(false)
        .Draggable(true)
        .Buttons(b => b.Close())
        .Content(@<text>
            @using (Html.BeginForm("DocumentDetails", "DocumentAppointment", FormMethod.Post, new { id = Model.documentid }))
            {
                @Html.TextAreaFor(m => m.LastComment, new { @style = "width: 293px; height: 260px;" })
                <div class="form-actions">
                    <button type="submit" class="t-button t-state-default">Сохранить</button>
                </div>
            }
        </text>)
        .Width(300)
        .Height(300)
        .Render();
}
<script language=javascript >
    function ShowCommentWindow() {
        var window = $("#CommentWindow").data("tWindow");
        window.center();
        window.open();
    }
</script>